package com.huanxing.cloud.user.api.feign;

import com.huanxing.cloud.common.core.constant.SecurityConstants;
import com.huanxing.cloud.common.core.constant.ServiceNameConstants;
import com.huanxing.cloud.common.core.util.Result;
import com.huanxing.cloud.user.api.entity.UserInfo;
import com.huanxing.cloud.user.api.vo.UserInfoVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

@FeignClient(contextId = "remoteMallUserService", value = ServiceNameConstants.MALL_USER_SERVICE)
public interface RemoteMallUserService {

	/**
	 * 根据手机号获取用户信息
	 * @param phone 手机号
	 * @param clientType 客户端类型
	 * @param source 来源
	 * @return 用户信息
	 */
	@GetMapping("/app/userinfo/phone/{phone}/{clientType}")
	Result<UserInfo> getInfoByPhone(@PathVariable("phone") String phone, @PathVariable("clientType") String clientType,
			@RequestHeader(SecurityConstants.SOURCE) String source);

	@GetMapping("/app/userinfo/{userId}")
	Result<UserInfoVO> getUserById(@PathVariable("userId") String userId,
			@RequestHeader(SecurityConstants.SOURCE) String source);

	@GetMapping("/app/userinfo/getByPhone/{phone}")
	Result<UserInfoVO> getUserByPhone(@PathVariable("phone") String phone,
			@RequestHeader(SecurityConstants.SOURCE) String source);

}
